package BitHomework;

import com.sun.media.jfxmediaimpl.HostUtils;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
import java.util.jar.JarOutputStream;

public class Practice_01 {

    public static void main(String[] args) {


        // 实现方法 compareTo, 能够实现按照字典序比较字符串大小
        String str1="Hello";
        String str2="hello";
        System.out.println( compareTo(str1,str2));
    }

    private static int compareTo(String str1, String str2) {
        char[] a1=str1.toCharArray();
        char[] a2=str2.toCharArray();
        int k=0;
        while(k<a1.length||k<a2.length){
            if(a1[k]!=a2[k]){
                return a1[k]-a2[k];
            }
            k++;
        }
        return Math.abs(a1.length-a2.length);

    }



}


